Search for Yahoo Finance Symbols
This package currently provides two ways to get tickers.
- you know the company/security name but are unsure about the ticker use
get_symbols() - you simply want all tickers listed on the NASDAQ, NYSE, AMEX, ARCA, or BATS use
get_all_symbols()
get_all_symbols reads the official Nasdaq Trader symbol directory and returns the symbols already translated to Yahoo Finance's convention, so they can be passed straight to get_prices:
| Security type | Exchange symbol | Yahoo symbol |
|---|---|---|
| Share class | BRK.A | BRK-A |
| Preferred | ABR-D | ABR-PD |
| Unit | AAC= | AAC-UN |
| Warrant | ACHR+ | ACHR-WT |
| Right | JACS^ | JACS-RI |
Pass yahoo=false to get the raw exchange symbols instead.
Structs
The Items returned by get_symbols
YahooSearch
Basically is a custom Array of YahooSearchItems returned by get_symbols.
mutable struct YahooSearch{YahooSearchItem,N} <: AbstractArray{YahooSearchItem,N}
arr::Array{YahooSearchItem,N}
endYahooSearchItem
This is an individual search item in YahooSearch. It contains the following fields:
- symbol: The Symbol (Ticker)
- shortname: The short name of the instrument/company
- quoteType: The type of asset (e.g. EQUITY)
- sector: The Sector (only if quotetype==EQUITY, otherwise "")
- industry: The Industry (only if quotetype==EQUITY, otherwise "")
mutable struct YahooSearchItem
symbol::String
shortname::String
exchange::String
quoteType::String
sector::String
industry::String
endSearch Functions
YFinance.get_symbols — Functionget_symbols(search_term::String)Allows searches for specific securities.
Arguments
search_term::String: Typically a company/security name (e.g. microsoft)
Returns
- A
YahooSearch <: AbstractArraycontainingYahooSearchItems containing the following fields: symbol::String, shortname::String, exchange::String, quoteType::String, sector::String, industry::String
Example
julia> get_symbols("micro")
7-element YahooSearch{YahooSearchItem, 1}:
Symbol: MGC=F
Name: Micro Gold Futures,Jun-2023
Type: FUTURE
Exch.: New York Commodity Exchange (CMX)
Symbol: MSFT
Name: Microsoft Corporation
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Software—Infrastructure
Symbol: AMD
Name: Advanced Micro Devices, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Semiconductors
Symbol: MU
Name: Micron Technology, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Semiconductors
Symbol: MSTR
Name: MicroStrategy Incorporated
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Software—Application
Symbol: SMCI
Name: Super Micro Computer, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Computer Hardware
Symbol: FNGU
Name: MicroSectors FANG Index 3X Lev
Type: ETF
Exch.: NYSEArca (PCX)YFinance.get_all_symbols — Functionget_all_symbols(market::AbstractString; yahoo::Bool=true)::Vector{String}Fetch all the symbols from a given market.
Arguments
market::AbstractString: The market to fetch the symbols from (case insensitive).
Currently supported markets are:
AMEX(NYSE American)ARCA(NYSE Arca)BATS(Cboe BZX)NASDAQNYSE
Keyword Arguments
yahoo::Bool: Iftrue(the default) symbols are translated to Yahoo Finance's convention (e.g.BRK.AbecomesBRK-A, the preferred shareABR-DbecomesABR-PD, the warrantACHR+becomesACHR-WT, the rightJACS^becomesJACS-RI, the unitAAC=becomesAAC-UN). Set tofalseto get the raw exchange symbols instead.
Uses the official Nasdaq Trader symbol directory (nasdaqtrader.com/dynamic/SymDir).
Returns
Vector{String}: A vector of strings containing the symbols.
Example
julia> get_all_symbols("NYSE")
2925-element Vector{String}:
"A"
"AA"
"AAC-UN"
"AADX"
⋮
"ZTR"
"ZTS"
"ZVIA"
"ZWS"